l = [1, 4, 2, 6, 3, 7, 5]

def l_max(l):
    i = 0
    for c in l:
        if c > i:
            i = c

    return i

def fun(l):
    l1 = []
    for i in range(len(l)):
        i = l_max(l)
        l1.append(i)
        l.remove(i)

    return l1[::-1]

print(fun(l))

# 方法2
def selection_sort(li):
    for i in range(len(li)-1):
        min_index = i
        for j in range(i, len(li)):
            if li[min_index] > li[j]:
                min_index = j
        li[min_index], li[i] = li[i], li[min_index]
    return li

print(selection_sort(l))

